package ControllerSrevlet;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import MYJDBC.jdbc;

/**
 * Servlet implementation class BlueVideoUserMsgFriend
 */
@WebServlet("/BlueVideoUserMsgFriend")
public class BlueVideoUserMsgFriend extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public BlueVideoUserMsgFriend() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		request.setCharacterEncoding("UTF-8");
		String fid = request.getParameter("fid");
		String userid = request.getParameter("userid");
		int feid = Integer.parseInt(fid);
		int useride = Integer.parseInt(userid);
		request.setAttribute("fid", feid);
		int a = 0;
		jdbc jc = new jdbc();
		request.setAttribute("SqlUser",jc.getSqlUser());
		request.setAttribute("SqlPass",jc.getSqlPass());
		request.setAttribute("SqlName", jc.getSqlName());
		try {
			jc.SqlUpdate("update user_msg set msg_log = "+a+" where user_id = "+useride+" AND user_myfid = "+feid+";");
			jc.UpdateClose();
			request.getRequestDispatcher("BlueVideoUserMsg").forward(request, response);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		
		
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
